| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

FreeListPager.h
1 // FreeListPager.h
3 //
5
6 namespace nkMemory
7 {
11 template <typename T>
12 struct FreeListAllocation
13 {
17 T _allocation ;
18
23 unsigned long long _index ;
24 } ;
25 }
26
27 namespace nkMemory
28 {
41 template <typename T = char*, typename U = DefaultMemorySpace>
42 class FreeListPager final
43 {
44 public :
45
52 FreeListPager (unsigned long long pageSize, UniquePtr<MemorySpaceAllocator<U>> allocator = makeUnique<DefaultMemorySpaceAllocator<U>>()) noexcept ;
56 FreeListPager (const FreeListPager&) noexcept = delete ;
60 FreeListPager (FreeListPager&&) noexcept = default ;
61
62 // Getters
66 unsigned long long getPageSize () const ;
70 unsigned long long getAllocatedPageCount () const ;
74 const FreeListMemorySpaceWrapper<T, U>& getPage (unsigned long long index) ;
75
76 // Allocations
86 FreeListAllocation<T> allocate (unsigned long long size, unsigned long long alignment = 1) ;
92 void free (unsigned long long allocationIndex) ;
93
94 public :
95
96 // Operators
100 FreeListPager& operator= (const FreeListPager&) noexcept = delete ;
104 FreeListPager& operator= (FreeListPager&&) noexcept = default ;
105 } ;
106 }
nkMemory::FreeListPager
A pager implementing the free list pattern.
Definition: FreeListPager.h:43
nkMemory::DefaultMemorySpaceAllocator
A default memory space allocator, offering the most basic memory allocation method.
Definition: DefaultMemorySpaceAllocator.h:24
nkMemory::FreeListAllocation::_index
unsigned long long _index
Definition: FreeListPager.h:23
nkMemory::FreeListPager::allocate
FreeListAllocation< T > allocate(unsigned long long size, unsigned long long alignment=1)
nkMemory::FreeListPager::free
void free(unsigned long long allocationIndex)
nkMemory::UniquePtr
Smart pointer owning the object instance it encapsulates.
Definition: UniquePtr.h:17
nkMemory::FreeListPager::getPageSize
unsigned long long getPageSize() const
nkMemory::FreeListPager::FreeListPager
FreeListPager(unsigned long long pageSize, UniquePtr< MemorySpaceAllocator< U >> allocator=makeUnique< DefaultMemorySpaceAllocator< U >>()) noexcept
nkMemory::FreeListPager::getAllocatedPageCount
unsigned long long getAllocatedPageCount() const
nkMemory::FreeListAllocation
Holds information about an allocation returned by the pager.
Definition: FreeListPager.h:13
nkMemory::FreeListPager::getPage
const FreeListMemorySpaceWrapper< T, U > & getPage(unsigned long long index)
nkMemory::FreeListAllocation::_allocation
T _allocation
Definition: FreeListPager.h:17
nkMemory::MemorySpaceAllocator
Defines the interface for a memory space allocator, to be used within the pagers.
Definition: MemorySpaceAllocator.h:13
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7